Skip to content

Re-fetch help threads before closing#3228

Merged
ChrisLovering merged 2 commits into
mainfrom
fix-thread-close
Jan 5, 2025
Merged

Re-fetch help threads before closing#3228
ChrisLovering merged 2 commits into
mainfrom
fix-thread-close

Conversation

@swfarnsworth
Copy link
Copy Markdown
Contributor

This ensures that the thread title is up-to-date. Previously, even if someone changed the title of the thread, the bot might prepend the lock emoji to an older version of the title.

This ensures that the thread title is up-to-date. Previously, even if someone changed the title of the thread, the bot might prepend the lock emoji to an older version of the title.
@swfarnsworth swfarnsworth added the a: help channels Related to the help channel system label Jan 4, 2025
@swfarnsworth
Copy link
Copy Markdown
Contributor Author

image

Comment thread bot/exts/help_channels/_channel.py Outdated
async def _close_help_post(closed_post: discord.Thread, closing_reason: _stats.ClosingReason) -> None:
"""Close the help post and record stats."""
# Get Thread with updated metadata (such as the title)
closed_post = await pydis_core.utils.channel.get_or_fetch_channel(bot.instance, closed_post.id)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
closed_post = await pydis_core.utils.channel.get_or_fetch_channel(bot.instance, closed_post.id)
closed_post = await get_or_fetch_channel(bot.instance, closed_post.id)

Looks like get_or_fetch_channel is already imported in this file, so we can drop the import pydis_core entirely

Copy link
Copy Markdown
Contributor

@vivekashok1221 vivekashok1221 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ChrisLovering ChrisLovering merged commit 41d15cc into main Jan 5, 2025
@ChrisLovering ChrisLovering deleted the fix-thread-close branch January 5, 2025 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: help channels Related to the help channel system

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants